package com.gzy.cbrsystem.nephritis.dao;

import java.sql.Timestamp;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 * A data access object (DAO) providing persistence and search support for YaZb
 * entities. Transaction control of the save(), update() and delete() operations
 * can directly support Spring container-managed transactions or they can be
 * augmented to handle user-managed Spring transactions. Each of these methods
 * provides additional information for how to configure it for the desired type
 * of transaction control.
 * 
 * @see com.gzy.cbrsystem.nephritis.dao.YaZb
 * @author MyEclipse Persistence Tools
 */

public class YaZbDAO extends HibernateDaoSupport {
	private static final Log log = LogFactory.getLog(YaZbDAO.class);
	// property constants
	public static final String BAH = "bah";
	public static final String HZXM = "hzxm";
	public static final String HZXB = "hzxb";
	public static final String HZZY = "hzzy";
	public static final String HZNL = "hznl";
	public static final String HZJG = "hzjg";
	public static final String HZZZ = "hzzz";
	public static final String HZDH = "hzdh";
	public static final String YJXM = "yjxm";
	public static final String KXD = "kxd";
	public static final String ZC = "zc";
	public static final String ZS = "zs";
	public static final String BS = "bs";
	public static final String TGJC = "tgjc";
	public static final String LHJC = "lhjc";
	public static final String SX = "sx";
	public static final String MX = "mx";
	public static final String GMS = "gms";
	public static final String ZYZD = "zyzd";
	public static final String XYZD = "xyzd";
	public static final String ZH = "zh";
	public static final String ZF = "zf";
	public static final String FY = "fy";
	public static final String YHZG = "yhzg";
	public static final String FM = "fm";
	public static final String BIEM = "biem";
	public static final String BY_KB = "byKb";
	public static final String YW_YYLY = "ywYyly";
	public static final String YW_ZZ = "ywZz";
	public static final String YW_GX = "ywGx";
	public static final String BY_JX = "byJx";
	public static final String BY_ZJYY = "byZjyy";
	public static final String YW_ZJ = "ywZj";
	public static final String BY_FYYY = "byFyyy";
	public static final String BY_FFA = "byFfa";
	public static final String BY_CS = "byCs";
	public static final String BY_WD = "byWd";
	public static final String BY_SJ = "bySj";
	public static final String YW_YF = "ywYf";
	public static final String YW_JJ = "ywJj";
	public static final String YW_YJ = "ywYj";
	public static final String YW_FYLX = "ywFylx";
	public static final String YW_BA = "ywBa";
	public static final String YW_FFANG = "ywFfang";
	public static final String YW_BJFX = "ywBjfx";
	public static final String YW_FZJB = "ywFzjb";
	public static final String YW_ZS = "ywZs";
	public static final String YW_KZ = "ywKz";
	public static final String YW_YW = "ywYw";
	public static final String YW_WXTL = "ywWxtl";
	public static final String BY_ZS = "byZs";
	public static final String BY_KZ = "byKz";
	public static final String BY_FFCS = "byFfcs";

	protected void initDao() {
		// do nothing
	}

	public void save(YaZb transientInstance) {
		log.debug("saving YaZb instance");
		try {
			getHibernateTemplate().save(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}

	public void delete(YaZb persistentInstance) {
		log.debug("deleting YaZb instance");
		try {
			getHibernateTemplate().delete(persistentInstance);
			log.debug("delete successful");
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}
	}

	public YaZb findById(java.lang.String id) {
		log.debug("getting YaZb instance with id: " + id);
		try {
			YaZb instance = (YaZb) getHibernateTemplate().get(
					"com.gzy.cbrsystem.nephritis.dao.YaZb", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public List findByExample(YaZb instance) {
		log.debug("finding YaZb instance by example");
		try {
			List results = getHibernateTemplate().findByExample(instance);
			log.debug("find by example successful, result size: "
					+ results.size());
			return results;
		} catch (RuntimeException re) {
			log.error("find by example failed", re);
			throw re;
		}
	}

	public List findByProperty(String propertyName, Object value) {
		log.debug("finding YaZb instance with property: " + propertyName
				+ ", value: " + value);
		try {
			String queryString = "from YaZb as model where model."
					+ propertyName + "= ?";
			return getHibernateTemplate().find(queryString, value);
		} catch (RuntimeException re) {
			log.error("find by property name failed", re);
			throw re;
		}
	}

	public List findByBah(Object bah) {
		return findByProperty(BAH, bah);
	}

	public List findByHzxm(Object hzxm) {
		return findByProperty(HZXM, hzxm);
	}

	public List findByHzxb(Object hzxb) {
		return findByProperty(HZXB, hzxb);
	}

	public List findByHzzy(Object hzzy) {
		return findByProperty(HZZY, hzzy);
	}

	public List findByHznl(Object hznl) {
		return findByProperty(HZNL, hznl);
	}

	public List findByHzjg(Object hzjg) {
		return findByProperty(HZJG, hzjg);
	}

	public List findByHzzz(Object hzzz) {
		return findByProperty(HZZZ, hzzz);
	}

	public List findByHzdh(Object hzdh) {
		return findByProperty(HZDH, hzdh);
	}

	public List findByYjxm(Object yjxm) {
		return findByProperty(YJXM, yjxm);
	}

	public List findByKxd(Object kxd) {
		return findByProperty(KXD, kxd);
	}

	public List findByZc(Object zc) {
		return findByProperty(ZC, zc);
	}

	public List findByZs(Object zs) {
		return findByProperty(ZS, zs);
	}

	public List findByBs(Object bs) {
		return findByProperty(BS, bs);
	}

	public List findByTgjc(Object tgjc) {
		return findByProperty(TGJC, tgjc);
	}

	public List findByLhjc(Object lhjc) {
		return findByProperty(LHJC, lhjc);
	}

	public List findBySx(Object sx) {
		return findByProperty(SX, sx);
	}

	public List findByMx(Object mx) {
		return findByProperty(MX, mx);
	}

	public List findByGms(Object gms) {
		return findByProperty(GMS, gms);
	}

	public List findByZyzd(Object zyzd) {
		return findByProperty(ZYZD, zyzd);
	}

	public List findByXyzd(Object xyzd) {
		return findByProperty(XYZD, xyzd);
	}

	public List findByZh(Object zh) {
		return findByProperty(ZH, zh);
	}

	public List findByZf(Object zf) {
		return findByProperty(ZF, zf);
	}

	public List findByFy(Object fy) {
		return findByProperty(FY, fy);
	}

	public List findByYhzg(Object yhzg) {
		return findByProperty(YHZG, yhzg);
	}

	public List findByFm(Object fm) {
		return findByProperty(FM, fm);
	}

	public List findByBiem(Object biem) {
		return findByProperty(BIEM, biem);
	}

	public List findByByKb(Object byKb) {
		return findByProperty(BY_KB, byKb);
	}

	public List findByYwYyly(Object ywYyly) {
		return findByProperty(YW_YYLY, ywYyly);
	}

	public List findByYwZz(Object ywZz) {
		return findByProperty(YW_ZZ, ywZz);
	}

	public List findByYwGx(Object ywGx) {
		return findByProperty(YW_GX, ywGx);
	}

	public List findByByJx(Object byJx) {
		return findByProperty(BY_JX, byJx);
	}

	public List findByByZjyy(Object byZjyy) {
		return findByProperty(BY_ZJYY, byZjyy);
	}

	public List findByYwZj(Object ywZj) {
		return findByProperty(YW_ZJ, ywZj);
	}

	public List findByByFyyy(Object byFyyy) {
		return findByProperty(BY_FYYY, byFyyy);
	}

	public List findByByFfa(Object byFfa) {
		return findByProperty(BY_FFA, byFfa);
	}

	public List findByByCs(Object byCs) {
		return findByProperty(BY_CS, byCs);
	}

	public List findByByWd(Object byWd) {
		return findByProperty(BY_WD, byWd);
	}

	public List findByBySj(Object bySj) {
		return findByProperty(BY_SJ, bySj);
	}

	public List findByYwYf(Object ywYf) {
		return findByProperty(YW_YF, ywYf);
	}

	public List findByYwJj(Object ywJj) {
		return findByProperty(YW_JJ, ywJj);
	}

	public List findByYwYj(Object ywYj) {
		return findByProperty(YW_YJ, ywYj);
	}

	public List findByYwFylx(Object ywFylx) {
		return findByProperty(YW_FYLX, ywFylx);
	}

	public List findByYwBa(Object ywBa) {
		return findByProperty(YW_BA, ywBa);
	}

	public List findByYwFfang(Object ywFfang) {
		return findByProperty(YW_FFANG, ywFfang);
	}

	public List findByYwBjfx(Object ywBjfx) {
		return findByProperty(YW_BJFX, ywBjfx);
	}

	public List findByYwFzjb(Object ywFzjb) {
		return findByProperty(YW_FZJB, ywFzjb);
	}

	public List findByYwZs(Object ywZs) {
		return findByProperty(YW_ZS, ywZs);
	}

	public List findByYwKz(Object ywKz) {
		return findByProperty(YW_KZ, ywKz);
	}

	public List findByYwYw(Object ywYw) {
		return findByProperty(YW_YW, ywYw);
	}

	public List findByYwWxtl(Object ywWxtl) {
		return findByProperty(YW_WXTL, ywWxtl);
	}

	public List findByByZs(Object byZs) {
		return findByProperty(BY_ZS, byZs);
	}

	public List findByByKz(Object byKz) {
		return findByProperty(BY_KZ, byKz);
	}

	public List findByByFfcs(Object byFfcs) {
		return findByProperty(BY_FFCS, byFfcs);
	}

	public List findAll() {
		log.debug("finding all YaZb instances");
		try {
			String queryString = "from YaZb";
			return getHibernateTemplate().find(queryString);
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}

	public YaZb merge(YaZb detachedInstance) {
		log.debug("merging YaZb instance");
		try {
			YaZb result = (YaZb) getHibernateTemplate().merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public void attachDirty(YaZb instance) {
		log.debug("attaching dirty YaZb instance");
		try {
			getHibernateTemplate().saveOrUpdate(instance);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public void attachClean(YaZb instance) {
		log.debug("attaching clean YaZb instance");
		try {
			getHibernateTemplate().lock(instance, LockMode.NONE);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public static YaZbDAO getFromApplicationContext(ApplicationContext ctx) {
		return (YaZbDAO) ctx.getBean("YaZbDAO");
	}
}